/****************************************************************************
@FILENAME:	ble_viot.h
@FUNCTION:	encoder/decoder for ble iot packet
@AUTHOR:	flege.zhang
@DATE:		2020.05.20
@COPYRIGHT(C) ZXW 2020
*****************************************************************************/
#ifndef _BLE_VIOT__H_
#define _BLE_VIOT__H_

#include "glh_typedef.h"

/********************************MACRO DEFINE********************************/

/*********************************ENUM DEFINE********************************/
enum en_ble_viot_ret
{
	BLE_VIOT_SUCCESS			= 0x00,
    BLE_VIOT_SAMEPACK_ERROR     = 0x01,
    BLE_VIOT_CRC_ERROR          = 0x02,
};
/*******************************STRUCT DEFINE********************************/
typedef struct
{
	uint8		rfu2[5];
	uint8		relay;
	uint8 	type;
	uint8 	version;
	uint8 	count;
	uint32 	addr;
	uint8 	group_index;
	uint8 	cmd;
	uint8 	para[5];
	uint8 	rfu[5];
}str_ble_viot_para;



uint8 ble_viot_encoder(str_ble_viot_para* opcode_para,uint8 rand_seed,uint8* out_data,uint8* out_data_len);
uint8 is_ble_viot_pdu(uint8* ble_payload,uint8 payload_len);
uint8 ble_viot_decoder(uint8* ble_payload,uint8 payload_len,str_ble_viot_para* opcode_para);

#endif
